<?php
    $page = $_GET['page'];
if($page=='library')
{
    $con=mysql_connect("localhost","root","");
    $db=mysql_select_db("db_lols",$con);

    $libraryName=$_POST['libraryName'];
    //$libraryNo=''];
    $address=$_POST['address'];
    $contactNo=$_POST['contactNo'];
    $description=$_POST['description'];
    //$imgfilename=''];

    $sql = "SELECT * FROM tbllibrary";
    $result = mysql_query($sql,$con);
    $ctr = mysql_num_rows($result)+1;
    $query = "INSERT INTO tbllibrary VALUES('" . $libraryName . "','".$ctr."','" . $address . "','" . $contactNo . "','" . $description . "','secret')";

    $result = mysql_query($query);
    if($result=true){
        //echo("Record sucessfully added.");
        $host  = $_SERVER['HTTP_HOST'];
        $uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
        $extra = 'libprofileview.php';
        header("Location: http://$host$uri/$extra");
    }else{
        echo("Adding failed.");
    }
    mysql_close();

}


?>
